From: Richard M. Stallman Date: Thu, 13 May 1993 03:24:09 +0000 (+0000) Subject: (face-initialize): New function. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96296 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=e09c52a8a05420a0ca150a4166826febb0dacac1;p=emacs.git (face-initialize): New function. All initialization code moved into it. Call at end of file, if using X frames already. (x-create-frame-with-faces): Don't use faces if not initialized. --- diff --git a/lisp/faces.el b/lisp/faces.el index 39e56f0cbaa..28323f5d737 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -604,8 +604,7 @@ If NOERROR is non-nil, return nil on failure." ;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2, ;;; respectively, so they must be the first three faces made. -(if (internal-find-face 'default) - nil +(defun face-initialize () (make-face 'default) (make-face 'modeline) (make-face 'highlight) @@ -617,7 +616,15 @@ If NOERROR is non-nil, return nil on failure." (make-face 'italic) (make-face 'bold-italic) (make-face 'primary-selection) - (make-face 'secondary-selection)) + (make-face 'secondary-selection) + + ;; Set up the faces of all existing X Window frames. + (let ((frames (frame-list))) + (while frames + (if (eq (framep (car frames)) 'x) + (x-initialize-frame-faces (car frames))) + (setq frames (cdr frames))))) + ;;; This really belongs in setting a frame's own font. ;;; ;; @@ -714,41 +721,40 @@ If NOERROR is non-nil, return nil on failure." ;; Like x-create-frame but also set up the faces. (defun x-create-frame-with-faces (&optional parameters) - (let* ((frame (x-create-frame parameters)) - (faces (copy-alist global-face-data)) - (rest faces) - default modeline) - (set-frame-face-alist frame faces) - - ;; Copy the vectors that represent the faces. - ;; Also fill them in from X resources. - (while rest - (setcdr (car rest) (copy-sequence (cdr (car rest)))) - (make-face-x-resource-internal (cdr (car rest)) frame t) - (setq rest (cdr rest))) - - (setq default (internal-get-face 'default frame) - modeline (internal-get-face 'modeline frame)) - - (x-initialize-frame-faces frame) - -;;; ;; Make sure the modeline face is fully qualified. -;;; (if (and (not (face-font modeline frame)) (face-font default frame)) -;;; (set-face-font modeline (face-font default frame) frame)) -;;; (if (and (not (face-background modeline frame)) -;;; (face-background default frame)) -;;; (set-face-background modeline (face-background default frame) frame)) -;;; (if (and (not (face-foreground modeline frame)) -;;; (face-foreground default frame)) -;;; (set-face-foreground modeline (face-foreground default frame) frame)) - frame)) - -;; Set up the faces of all existing frames. -(let ((frames (frame-list))) - (while frames - (if (eq (framep (car frames)) 'x) - (x-initialize-frame-faces (car frames))) - (setq frames (cdr frames)))) + (if (null global-face-data) + (x-create-frame parameters) + (let* ((frame (x-create-frame parameters)) + (faces (copy-alist global-face-data)) + (rest faces) + default modeline) + (set-frame-face-alist frame faces) + + ;; Copy the vectors that represent the faces. + ;; Also fill them in from X resources. + (while rest + (setcdr (car rest) (copy-sequence (cdr (car rest)))) + (make-face-x-resource-internal (cdr (car rest)) frame t) + (setq rest (cdr rest))) + + (setq default (internal-get-face 'default frame) + modeline (internal-get-face 'modeline frame)) + + (x-initialize-frame-faces frame) + + ;;; ;; Make sure the modeline face is fully qualified. + ;;; (if (and (not (face-font modeline frame)) (face-font default frame)) + ;;; (set-face-font modeline (face-font default frame) frame)) + ;;; (if (and (not (face-background modeline frame)) + ;;; (face-background default frame)) + ;;; (set-face-background modeline (face-background default frame) frame)) + ;;; (if (and (not (face-foreground modeline frame)) + ;;; (face-foreground default frame)) + ;;; (set-face-foreground modeline (face-foreground default frame) frame)) + frame))) + +;; If we are already using x-window frames, initialize faces for them. +(if (eq (framep (selected-frame)) 'x) + (face-initialize)) (provide 'faces)